/**
 * Created by zhangtao on 16-5-29.
 */
/*$('#myTabs a').click(function (e) {
 e.preventDefault()
 $(this).tab('show')
 })
 $('#myTabs a[href="#accept"]').tab('show') // Select tab by name
 $('#myTabs a:first').tab('show') // Select first tab
 $('#myTabs a:last').tab('show') // Select last tab
 $('#myTabs li:eq(2) a').tab('show') // Select third tab (0-indexed)*/

$(function () {
    $("#login").click(function () {
        $(".bs-example-modal-sm").modal('show');
    });
    $("#lg").click(function () {
        $.ajax(
            {
                url: "http://dirtytao.com/androidAPI/user/signin",
                data: {username: $('#username').val(), password: $('#password').val()},
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    if (data.status.trim() == 'success') {
                        /*$(".bs-example-modal-sm").modal('hide');
                         $("#login").html('你好，'+$('#username').val());*/
                        location.reload();
                    }
                    else {
                        $('#inform_account_login').show();
                    }
                }

            }
        )
    });
    $(".acceptJD").click(function () {
        // alert(this.dataset.id);
        var id = this.dataset.id;
        $.ajax(
            {
                url: "http://dirtytao.com/androidAPI/Order/update",
                data: {id: id, state: 111},
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    if (data.status.trim() == 'success') {
                        location.reload();
                    }
                    else {
                        alert('出了点小状况...');
                    }
                }

            }
        )
    });
    $(".refuseJD").click(function () {
        //alert(this.dataset.id);
        var id = this.dataset.id;
        $.ajax(
            {
                url: "http://dirtytao.com/androidAPI/Order/update",
                data: {id: id, state: 110},
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    if (data.status.trim() == 'success') {
                        location.reload();
                    }
                    else {
                        alert('出了点小状况...');
                    }
                }

            }
        )
    });
    $(".acceptTD").click(function () {
        // alert(this.dataset.id);
        var id = this.dataset.id;
        $.ajax(
            {
                url: "http://dirtytao.com/androidAPI/Order/update",
                data: {id: id, state: 11101},
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    if (data.status.trim() == 'success') {
                        location.reload();
                    }
                    else {
                        alert('出了点小状况...');
                    }
                }

            }
        )
    });
    $(".refuseTD").click(function () {
        // alert(this.dataset.id);
        var id = this.dataset.id;
        $.ajax(
            {
                url: "http://dirtytao.com/androidAPI/Order/update",
                data: {id: id, state: 11100},
                type: 'post',
                dataType: 'json',
                success: function (data) {
                    if (data.status.trim() == 'success') {
                        location.reload();
                    }
                    else {
                        alert('出了点小状况...');
                    }
                }

            }
        )
    });
});
